From: Sebastian Keller Date: Tue, 6 May 2025 00:40:18 +0000 (+0200) Subject: breakManager: Use uninhibitable idle watch X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~39^2~1^2~23 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b2e5a125ae8bf682b0d54d925ce8fdf26680b48e;p=gnome-shell.git breakManager: Use uninhibitable idle watch If we use a regular idle watch, any session inhibitors can prevent the watch from triggering, leading to the break manager to never consider the break as having been completed until the inhibitor is gone. This could lead to situations in which the system appears to be stuck with a dimmed screen. Also start the idle time when the idle watch is created, otherwise any previous idle time would count towards it, causing the watch to trigger early, leaving it inconsistent with the rest of the break manager state. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8378 Part-of: --- diff --git a/js/misc/breakManager.js b/js/misc/breakManager.js index a72b9c109..c90e0a9d5 100644 --- a/js/misc/breakManager.js +++ b/js/misc/breakManager.js @@ -26,6 +26,7 @@ import Cogl from 'gi://Cogl'; import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; +import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import St from 'gi://St'; @@ -194,7 +195,10 @@ export const BreakManager = GObject.registerClass({ } _startStateMachine() { - this._idleWatchId = this._idleMonitor.add_idle_watch(MIN_BREAK_LENGTH_SECONDS * 1000, this._onIdleWatch.bind(this)); + this._idleWatchId = this._idleMonitor.add_idle_watch_full( + MIN_BREAK_LENGTH_SECONDS * 1000, + this._onIdleWatch.bind(this), + Meta.IdleMonitorWatchFlags.UNINHIBITABLE | Meta.IdleMonitorWatchFlags.START_NOW); this._state = BreakState.ACTIVE; this._currentBreakType = null; diff --git a/tests/unit/breakManager.js b/tests/unit/breakManager.js index e74477696..96d6c6048 100644 --- a/tests/unit/breakManager.js +++ b/tests/unit/breakManager.js @@ -209,7 +209,7 @@ class TestHarness { // simulated clock and event queue. get mockIdleMonitor() { return { - add_idle_watch: (waitMsec, callback) => { + add_idle_watch_full: (waitMsec, callback, _flags) => { console.assert(this._idleWatch === null); this._idleWatch = { waitMsec,